package com.lnsoft.cac.server.handle;

import com.lnsoft.cac.server.handle.codec.Device;
import com.lnsoft.cac.server.handle.codec.CACDecoder;
import com.lnsoft.cac.server.handle.codec.CACEncoder;
import com.lnsoft.cac.server.handle.threadpools.ServiceInvokePools;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class HandleFactory {

    @Autowired
    private ServiceInvokePools invokePools;

    @Autowired
    private CACGlobalData cacGlobalData;

    public HeartBeatServerHandle createHeartBeatServerHandle(Device device){
        return  new HeartBeatServerHandle(device);
    }

    public CACDecoder createCacDecoder(){
        return new CACDecoder();
    }

    public CACEncoder createCacEncoder(){
        return new CACEncoder();
    }

    public CACChannelHandle createCacChannelHandle(Device device){
        return new CACChannelHandle(device,invokePools,cacGlobalData);
    }

}
